// 管理图片的map服务
import config from '../config';
type mapkey = keyof typeof config.images;
export let images = new Map<mapkey, HTMLImageElement>();
export const promises = Object.entries(config.images).map(([key, value]) => {
  return new Promise(resolve => {
    let img = document.createElement('img');
    img.src = value;
    img.onload = function () {
      images.set(key as mapkey, img);
      resolve(img);
    };
  });
})